﻿using Box2DX.Collision;
using Box2DX.Dynamics;

namespace PhysicsProject.Entities.Models
{
    public class Box
    {
        private Body _underlying;

        public Box(World world, float x = 0f, float y = 0f)
        {
            var def = new BodyDef();
            def.Position.Set(x,y);
            var shape = new PolygonDef();
            shape.SetAsBox(1.0f, 1.0f);
            shape.Friction = .3F;
            shape.Density = 1.0f;
            _underlying = world.CreateBody(def);
            _underlying.CreateShape(shape);
            _underlying.SetMassFromShapes();
        }

        public float RotationAngle
        {
            get { return (float)(_underlying.GetAngle()*180/System.Math.PI); }
        }

        public float X
        {
            get { return _underlying.GetPosition().X; }
        }
        
        public float Y
        {
            get { return _underlying.GetPosition().Y; }
        }

        public float CurrentTemperature { get; set; }

        public Material MaterialType { get; set; }
    }

}
